<template>
	<view class="newBody">
		<div>
			<navitop>
				<i class="iconfont icon-jiantou-copy" slot="left-slot" @click="outlot"></i>
				<span slot="center-slot">
					<h4>{{titles}}</h4>
				</span>
				<i slot="right-slot" class="iconfont icon-youcecaidan" @click="class_sort"></i>
			</navitop>
		</div>
		<view :style="'margin-top:' + nv_height"></view>
		<view class="from_Items from_Items_top">
			<div>加工数量</div>
			<div>实完</div>
			<div style="border-right:1px solid #cacaca ;">剩余</div>
		</view>
		<view class="from_Items from_Items_top" style=" background-color: #EDEDED;">
			<view>1</view>
			<view>1</view>
			<view>1</view>
		</view>
		<view class="code_class">
			<view>扫码信息</view>
			<view class="from_Items" >
				<text class="title">扫码数据:</text>
				<input class="Input" placeholder="请输入废品数量" type="number" v-model="sweep_code" />
			</view>
		</view>
		<view class="code_white"></view>
		<view class="from_Items" @tap="go_Details(1)">
			<text class="title">单据主题:</text>
			<input class="Input" placeholder="请输入废品数量" type="number" v-model="fpNumber" />
		</view>

		<view class="from_Items" @tap="go_Details(2)">
			<text class="title">人员:</text>
			<input class="Input" placeholder="请输入废品数量" type="number" v-model="fpNumber" />
		</view>


		<view class="from_Items" @tap="go_Details(3)">
			<text class="title">工序名称:</text>
			<input class="Input" placeholder="请输入废品数量" type="number" v-model="fpNumber" />
		</view>



		<view class="from_Items">
			<text class="title">序列号:</text>
			<input class="Input" placeholder="请输入合格数量" type="number" v-model="hgNumber" />
		</view>

		<view class="from_Items">
			<text class="title">汇报数量:</text>
			<input class="Input" placeholder="请输入返工数量" type="number" v-model="fgNumber" />
		</view>

		<view class="from_Items">
			<text class="title">加工工时:</text>
			<input class="Input" placeholder="请输入废品数量" type="number" v-model="fpNumber" />
		</view>

		<view class="from_Items">
			<text class="title">备注:</text>
			<input class="Input" placeholder="请输入废品数量" type="number" v-model="fpNumber" />
		</view>

		<view class="from_Items">
			<text class="title">检验结果:</text>
			<input class="Input" placeholder="请输入废品数量" type="number" v-model="fpNumber" />
		</view>


		<!-- <view hover-class="jsShow" class="jsBtns" @tap="addCartChange">提交新增</view> -->




	</view>
</template>

<script>
	import navitop from '@/components/common/navi-top'
	export default {
		data() {
			return {
				timeout: null,
				ProcessingNumber: '',
				ProductName: '',
				ProcessName: '',
				hgNumber: '',
				fgNumber: '',
				fpNumber: '',
				nv_height: '', //获取导航高度 
				titles: '工序汇报',
				sweep_code: '',
			}
		},

		components: {
			navitop,
		},
		
		onLoad(val) {
			this.sweep_code = val;
		},

		onShow() {
			uni.$on('otherFun', (res) => {
				//加工单号
				if (res.index == 1) {
					this.ProcessingNumber = res.ProcessingNumber;
				}
			});
		},

		mounted() {
			this.nv_height = uni.getSystemInfoSync().statusBarHeight + 75 + 'px';
		},

		methods: {

			outlot() {
				console.log(123)
				uni.navigateTo({
					url: '/components/index-modules/Manufacturing/processCard'
				})
			},

			addCartChange() {
				if (!this.ProcessingNumber) {
					this.debounce('请选择加工单号');
					return;
				}
				if (!this.ProductName) {
					this.debounce('请选择产品名称');
					return;
				}
				if (!this.ProcessName) {
					this.debounce('请选择工序名称');
					return;
				}
				if (!this.hgNumber) {
					this.debounce('请填写合格数量');
					return;
				}
				if (!this.fgNumber) {
					this.debounce('请填写返工数量');
					return;
				}
				if (!this.fpNumber) {
					this.debounce('请填写废品数量');
					return;
				}
			},

			debounce(str) {
				if (this.timeout) clearTimeout(this.timeout);
				this.timeout = setTimeout(() => {
					uni.showToast({
						icon: 'none',
						title: str
					});
					this.timeout = null;
				}, 500);
			},
			
			go_Details(index) {
				if (!this.ProcessingNumber && index == 2) {
					this.debounce('请先选择加工单号');
					return;
				};
				if (index == 3) {
					if (!this.ProcessingNumber && !this.ProductName) {
						this.debounce('请先选择加工单号');
						return;
					} else if (this.ProcessingNumber && !this.ProductName) {
						this.debounce('请先选择产品名称');
						return;
					}
				}
				uni.navigateTo({
					url: `new-addCar?index=${index}`
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.newBody {
		width: 750rpx;
		height: 100%;
		background-color: white;
	}
	
	.code_white {
		height: 10px;
		background-color: #F0F0F0;
	}
	.code_class {
		margin-bottom: 10px;
		input {
			border: 0;
		}
	}

	.from_Items {
		width: 700rpx;
		height: 100rpx;
		margin: 0 auto;
		display: flex;
		flex-direction: row;
		align-items: center;
		border-bottom: 1rpx dashed #808080;

		.title {
			font-size: 30rpx;
			width: 30%;
			text-align: right;
		}

		.textCont {
			font-size: 30rpx;
			width: 450rpx;
			text-align: center;
			white-space: nowrap;
			overflow: hidden;
			text-overflow: ellipsis;
			margin-left: 30rpx;
			text-align: left;
		}

		.Input {
			margin-left: 30rpx;
			width: 450rpx;
			height: 100rpx;
			text-align: center;
			text-align: left;
		}
	}

	.from_Items_top {
		justify-content: space-around !important;
		border-bottom: 1px solid #cacaca !important;
		width: 100% !important;
		background-color: #DDDDDD;

		div {
			border-left: 1px solid #cacaca;
			width: 34%;
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
		}
	}

	.jsBtns {
		width: 600rpx;
		height: 80rpx;
		border-radius: 15rpx;
		color: white;
		background-color: #007AFF;
		text-align: center;
		line-height: 80rpx;
		letter-spacing: 10rpx;
		font-size: 40rpx;
		margin: 100rpx auto 0;
	}

	.jsShow {
		background-color: #131eff;
	}
</style>
